home *** CD-ROM | disk | FTP | other *** search
/ AGA Toolkit '97 / The AGA Toolkit '97.iso / miscellaneous / science / maths / calc / source / opcodes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-07  |  5.9 KB  |  123 lines

  1. /*
  2.  * Copyright (c) 1993 David I. Bell
  3.  * Permission is granted to use, distribute, or modify this source,
  4.  * provided that this copyright notice remains intact.
  5.  */
  6.  
  7. #ifndef    OPCODES_H
  8. #define    OPCODES_H
  9.  
  10.  
  11. /*
  12.  * Opcodes
  13.  */
  14. #define OP_NOP        0L    /* no operation */
  15. #define OP_LOCALADDR    1L    /* load address of local variable */
  16. #define OP_GLOBALADDR    2L    /* load address of global variable */
  17. #define OP_PARAMADDR    3L    /* load address of paramater variable */
  18. #define OP_LOCALVALUE    4L    /* load value of local variable */
  19. #define OP_GLOBALVALUE    5L    /* load value of global variable */
  20. #define OP_PARAMVALUE    6L    /* load value of paramater variable */
  21. #define OP_NUMBER    7L    /* load constant real numeric value */
  22. #define OP_INDEXADDR    8L    /* load array index address */
  23. #define    OP_PRINTRESULT    9L    /* print result of top-level expression */
  24. #define OP_ASSIGN    10L    /* assign value to variable */
  25. #define OP_ADD        11L    /* add top two values */
  26. #define OP_SUB        12L    /* subtract top two values */
  27. #define OP_MUL        13L    /* multiply top two values */
  28. #define OP_DIV        14L    /* divide top two values */
  29. #define OP_MOD        15L    /* take mod of top two values */
  30. #define OP_SAVE        16L    /* save value for later use */
  31. #define OP_NEGATE    17L    /* negate top value */
  32. #define OP_INVERT    18L    /* invert top value */
  33. #define OP_INT        19L    /* take integer part of top value */
  34. #define OP_FRAC        20L    /* take fraction part of top value */
  35. #define OP_NUMERATOR    21L    /* take numerator of top value */
  36. #define OP_DENOMINATOR    22L    /* take denominator of top value */
  37. #define OP_DUPLICATE    23L    /* duplicate top value on stack */
  38. #define OP_POP        24L    /* pop top value from stack */
  39. #define OP_RETURN    25L    /* return value of function */
  40. #define OP_JUMPEQ    26L    /* jump if top value is zero */
  41. #define OP_JUMPNE    27L    /* jump if top value is nonzero */
  42. #define OP_JUMP        28L    /* jump unconditionally */
  43. #define OP_USERCALL    29L    /* call a user-defined function */
  44. #define OP_GETVALUE    30L    /* convert address to value */
  45. #define OP_EQ        31L    /* test top two elements for equality */
  46. #define OP_NE        32L    /* test top two elements for inequality */
  47. #define OP_LE        33L    /* test top two elements for <= */
  48. #define OP_GE        34L    /* test top two elements for >= */
  49. #define OP_LT        35L    /* test top two elements for < */
  50. #define OP_GT        36L    /* test top two elements for > */
  51. #define OP_PREINC    37L    /* add one to variable (++x) */
  52. #define OP_PREDEC    38L    /* subtract one from variable (--x) */
  53. #define OP_POSTINC    39L    /* add one to variable (x++) */
  54. #define OP_POSTDEC    40L    /* subtract one from variable (x--) */
  55. #define OP_DEBUG    41L    /* debugging point */
  56. #define OP_PRINT    42L    /* print value */
  57. #define OP_ASSIGNPOP    43L    /* assign to variable and remove it */
  58. #define OP_ZERO        44L    /* put zero on the stack */
  59. #define OP_ONE        45L    /* put one on the stack */
  60. #define OP_PRINTEOL    46L    /* print end of line */
  61. #define OP_PRINTSPACE    47L    /* print a space */
  62. #define OP_PRINTSTRING    48L    /* print constant string */
  63. #define OP_DUPVALUE    49L    /* duplicate value of top value */
  64. #define OP_OLDVALUE    50L    /* old calculation value */
  65. #define OP_QUO        51L    /* integer quotient of top two values */
  66. #define OP_POWER    52L    /* number raised to a power */
  67. #define OP_QUIT        53L    /* quit program */
  68. #define OP_CALL        54L    /* call built-in routine */
  69. #define OP_GETEPSILON    55L    /* get allowed error for calculations */
  70. #define OP_AND        56L    /* arithmetic and */
  71. #define OP_OR        57L    /* arithmetic or */
  72. #define OP_NOT        58L    /* logical not */
  73. #define OP_ABS        59L    /* absolute value */
  74. #define OP_SGN        60L    /* sign of number */
  75. #define OP_ISINT    61L    /* whether top value is integer */
  76. #define OP_CONDORJUMP    62L    /* conditional or jump */
  77. #define OP_CONDANDJUMP    63L    /* conditional and jump */
  78. #define OP_SQUARE    64L    /* square top value */
  79. #define OP_STRING    65L    /* load constant string value */
  80. #define OP_ISNUM    66L    /* whether top value is a number */
  81. #define OP_UNDEF    67L    /* load undefined value on stack */
  82. #define OP_ISNULL    68L    /* whether variable is the null value */
  83. #define OP_ARGVALUE    69L    /* load value of argument (parameter) n */
  84. #define OP_MATCREATE    70L    /* create matrix */
  85. #define OP_ISMAT    71L    /* whether variable is a matrix */
  86. #define OP_ISSTR    72L    /* whether variable is a string */
  87. #define OP_GETCONFIG    73L    /* get value of configuration parameter */
  88. #define OP_LEFTSHIFT    74L    /* left shift of integer */
  89. #define OP_RIGHTSHIFT    75L    /* right shift of integer */
  90. #define OP_CASEJUMP    76L    /* test case and jump if not matched */
  91. #define OP_ISODD    77L    /* whether value is an odd integer */
  92. #define OP_ISEVEN    78L    /* whether value is even integer */
  93. #define OP_FIADDR    79L    /* 'fast index' matrix value address */
  94. #define OP_FIVALUE    80L    /* 'fast index' matrix value */
  95. #define OP_ISREAL    81L    /* test value for real number */
  96. #define OP_IMAGINARY    82L    /* load imaginary numeric constant */
  97. #define OP_RE        83L    /* real part of complex number */
  98. #define OP_IM        84L    /* imaginary part of complex number */
  99. #define OP_CONJUGATE    85L    /* complex conjugate of complex number */
  100. #define OP_OBJCREATE    86L    /* create object */
  101. #define OP_ISOBJ    87L    /* whether value is an object */
  102. #define OP_NORM        88L    /* norm of value (square of abs) */
  103. #define OP_ELEMADDR    89L    /* address of element of object */
  104. #define OP_ELEMVALUE    90L    /* value of element of object */
  105. #define OP_ISTYPE    91L    /* whether two values are the same type */
  106. #define OP_SCALE    92L    /* scale value by a power of two */
  107. #define    OP_ISLIST    93L    /* whether value is a list */
  108. #define    OP_SWAP        94L    /* swap values of two variables */
  109. #define    OP_ISSIMPLE    95L    /* whether value is a simple type */
  110. #define    OP_CMP        96L    /* compare values returning -1, 0, or 1 */
  111. #define    OP_QUOMOD    97L    /* calculate quotient and remainder */
  112. #define    OP_SETCONFIG    98L    /* set configuration parameter */
  113. #define    OP_SETEPSILON    99L    /* set allowed error for calculations */
  114. #define    OP_ISFILE    100L    /* whether value is a file */
  115. #define    OP_ISASSOC    101L    /* whether value is an association */
  116. #define    OP_INITSTATIC    102L    /* once only code for static initialization */
  117. #define    OP_ELEMINIT    103L    /* assign element of matrix or object */
  118. #define MAX_OPCODE    103L    /* highest legal opcode */
  119.  
  120. #endif
  121.  
  122. /* END CODE */
  123.